package chapter03;

public class Test09_instanceof {
    public static void main(String[] args) {
        Water w = new Water();
        CoCol c = new CoCol();
        //由类实例化出的对象 进行instanceof 为true
        System.out.println(c instanceof CoCol);
        //子类对象和父类 进行instanceof 为true
        System.out.println(c instanceof Water);
        //父类对象和子类进行instanceof 为false
        System.out.println(w instanceof CoCol);
    }
}
class Water{}
class CoCol extends Water{}
